from django.db import models

from prj002.models.models import CreatTimeModel
from prj002.models.info import Info
from myuser.models import MyUser


class History(CreatTimeModel):

    info = models.OneToOneField(Info, on_delete=models.CASCADE, related_name='history')

    owner = models.ForeignKey(MyUser, on_delete=models.CASCADE, related_name='prj002_history')

    duonang_year = models.CharField(max_length=4, verbose_name='多囊卵巢综合征-年', null=True, blank=True, help_text="多囊卵巢综合征-年")
    duonang_month = models.CharField(max_length=4, verbose_name='多囊卵巢综合征-月', null=True, blank=True, help_text="多囊卵巢综合征-月")

    other_disease = models.BooleanField(null=True, blank=True, verbose_name='其他疾病史', help_text='其他疾病史')

    shengzhi_qing = models.BooleanField(default=False, blank=True, verbose_name='青春期功血', help_text='青春期功血')
    shengzhi_bi = models.BooleanField(default=False, blank=True, verbose_name='闭经', help_text='闭经')
    shengzhi_yue = models.BooleanField(default=False, blank=True, verbose_name='月经失调', help_text='月经失调')
    shengzhi_bu = models.BooleanField(default=False, blank=True, verbose_name='不孕', help_text='不孕')
    shengzhi_zi = models.BooleanField(default=False, blank=True, verbose_name='自然流产', help_text='自然流产')
    shengzhi_ti = models.BooleanField(default=False, blank=True, verbose_name='体外受精', help_text='体外受精')
    shengzhi_zi_juti = models.IntegerField(null=True, blank=True, verbose_name='具体孕周', help_text='具体孕周')
    shengzhi_ti_pei = models.IntegerField(null=True, blank=True, verbose_name='胚胎移植', help_text='胚胎移植')
    shengzhi_ti_zhuo = models.IntegerField(null=True, blank=True, verbose_name='着床', help_text='着床')

    daixie_fei = models.BooleanField(default=False, blank=True, verbose_name='肥胖', help_text='肥胖')
    daixie_gao = models.BooleanField(default=False, blank=True, verbose_name='高血脂', help_text='高血脂')
    daixie_yi = models.BooleanField(default=False, blank=True, verbose_name='胰岛素抵抗', help_text='胰岛素抵抗')
    daixie_tang = models.BooleanField(default=False, blank=True, verbose_name='糖尿病', help_text='糖尿病')
    daixie_xin = models.BooleanField(default=False, blank=True, verbose_name='心血管疾病', help_text='心血管疾病')

    yunchan_chen = models.BooleanField(default=False, blank=True, verbose_name='妊娠期糖尿病', help_text='妊娠期糖尿病')
    yunchan_gao = models.BooleanField(default=False, blank=True, verbose_name='妊娠期高血压疾病', help_text='妊娠期高血压疾病')
    yunchan_ju = models.BooleanField(default=False, blank=True, verbose_name='巨大儿', help_text='巨大儿')
    yunchan_di = models.BooleanField(default=False, blank=True, verbose_name='低体重儿', help_text='低体重儿')
    yunchan_tai = models.BooleanField(default=False, blank=True, verbose_name='胎儿宫内发育迟缓', help_text='胎儿宫内发育迟缓')
    yunchan_zao = models.BooleanField(default=False, blank=True, verbose_name='早产', help_text='早产')
    yunchan_xian = models.BooleanField(default=False, blank=True, verbose_name='子宫腺肌症', help_text='子宫腺肌症')
    yunchan_yi = models.BooleanField(default=False, blank=True, verbose_name='子宫内膜异位症', help_text='子宫内膜异位症')
    yunchan_ji = models.BooleanField(default=False, blank=True, verbose_name='子宫肌瘤', help_text='子宫肌瘤')
    yunchan_luan = models.BooleanField(default=False, blank=True, verbose_name='卵巢囊肿', help_text='卵巢囊肿')
    yunchan_pen = models.BooleanField(default=False, blank=True, verbose_name='盆腔炎性疾病', help_text='盆腔炎性疾病')
    yunchan_yin = models.BooleanField(default=False, blank=True, verbose_name='阴道炎', help_text='阴道炎')
    yunchan_jian = models.BooleanField(default=False, blank=True, verbose_name='甲减', help_text='甲减')
    yunchan_kang = models.BooleanField(default=False, blank=True, verbose_name='甲亢', help_text='甲亢')
    yunchan_shen = models.BooleanField(default=False, blank=True, verbose_name='肾上腺相关疾病', help_text='肾上腺相关疾病')
    yunchan_xueye = models.BooleanField(default=False, blank=True, verbose_name='血液系统相关疾病', help_text='血液系统相关疾病')
    yunchan_liu = models.BooleanField(default=False, blank=True, verbose_name='脑垂体瘤', help_text='脑垂体瘤')
    yunchan_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='孕产期并发症-其他', help_text='孕产期并发症-其他')

    person_eat_zc = models.BooleanField(default=False, blank=True, verbose_name='正常', help_text='正常')
    person_eat_bao = models.BooleanField(default=False, blank=True, verbose_name='过饱', help_text='过饱')
    person_eat_ji = models.BooleanField(default=False, blank=True, verbose_name='过饥', help_text='过饥')
    person_eat_xi = models.BooleanField(default=False, blank=True, verbose_name='喜甜', help_text='喜甜')
    person_eat_fei = models.BooleanField(default=False, blank=True, verbose_name='肥甘厚腻', help_text='肥甘厚腻')
    person_eat_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='饮食习惯-其他', help_text='饮食习惯-其他')
    person_hobby_wu = models.BooleanField(default=False, blank=True, verbose_name='无', help_text='无')
    person_hobby_xi = models.BooleanField(default=False, blank=True, verbose_name='吸烟', help_text='吸烟')
    person_hobby_yin = models.BooleanField(default=False, blank=True, verbose_name='饮酒', help_text='饮酒')
    person_hobby_ao = models.BooleanField(default=False, blank=True, verbose_name='熬夜（23：00以后睡)', help_text='熬夜(23：00以后睡)')
    person_hobby_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='特殊嗜好-其他', help_text='特殊嗜好-其他')

    person_born_zu = models.BooleanField(default=False, blank=True, verbose_name='足月产', help_text='足月产')
    person_born_zao = models.BooleanField(default=False, blank=True, verbose_name='早产', help_text='早产')
    person_born_di = models.BooleanField(default=False, blank=True, verbose_name='低体重儿', help_text='低体重儿')
    person_born_ju = models.BooleanField(default=False, blank=True, verbose_name='巨大儿', help_text='巨大儿')
    person_born_bu = models.BooleanField(default=False, blank=True, verbose_name='不详', help_text='不详')

    PERSON_KNOW_CHOICES = (
        ('不了解', '不了解'),
        ('有一定了解', '有一定了解'),
        ('了解', '了解')
    )
    person_know = models.CharField(max_length=10, choices=PERSON_KNOW_CHOICES, null=True, blank=True, verbose_name='对生活方式与本病的认知程度', help_text='对生活方式与本病的认知程度')

    person_source_ke = models.BooleanField(default=False, blank=True, verbose_name='科普文章', help_text='科普文章')
    person_source_wang = models.BooleanField(default=False, blank=True, verbose_name='网络信息', help_text='网络信息')
    person_source_yi = models.BooleanField(default=False, blank=True, verbose_name='医护宣教', help_text='医护宣教')

    FIRST_TIME_CHOICES = (
        ('＜10周岁', '＜10周岁'),
        ('10≤年龄≤16周岁', '10≤年龄≤16周岁'),
        ('≤16周岁', '≤16周岁')
    )
    first_time = models.CharField(max_length=20, choices=FIRST_TIME_CHOICES, null=True, blank=True, verbose_name='月经初潮年龄', help_text='月经初潮年龄')
    first_time_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='月经初潮年龄-其他', help_text='月经初潮年龄-其他')

    YUEJING_ZHOUQI_CHOICES = (
        ('规律', '规律'),
        ('稀发', '稀发'),
        ('频发', '频发'),
        ('月经不规则', '月经不规则')
    )
    yuejing_zhouqi = models.CharField(choices=YUEJING_ZHOUQI_CHOICES, max_length=10, null=True, blank=True, verbose_name='规律', help_text='规律')

    YUEJING_LIANG_CHOICES = (('正常', '正常'), ('少', '少'), ('中', '中'), ('多', '多'))
    yuejing_liang = models.CharField(choices=YUEJING_LIANG_CHOICES, max_length=2, null=True, blank=True, verbose_name='经量', help_text='经量')

    YUEJING_TIME_CHOICES = (('正常', '正常'), ('延长', '延长'))
    yuejing_time = models.CharField(choices=YUEJING_TIME_CHOICES, max_length=4, null=True, blank=True, verbose_name='经期', help_text='经期')

    yuejing_lmp = models.DateField(null=True, blank=True, verbose_name='LMP', help_text='LMP')
    yuejing_pmp = models.DateField(null=True, blank=True, verbose_name='PMP', help_text='PMP')

    DHL_CHOICES = (
        ('正常', '正常'),
        ('少', '少'),
        ('多', '多')
    )
    daixia_history_liang = models.CharField(max_length=4, choices=DHL_CHOICES, null=True, blank=True, verbose_name='带下量', help_text='带下量')

    DHS_CHOICES = (
        ('白', '白'),
        ('黄', '黄'),
        ('黄绿', '黄绿'),
        ('赤', '赤')
    )
    daixia_history_se = models.CharField(max_length=4, choices=DHS_CHOICES, null=True, blank=True, verbose_name='带下色', help_text='带下色')

    DHS_CHOICES = (
        ('黏而不稠', '黏而不稠'),
        ('清稀', '清稀'),
        ('稠', '稠'),
    )
    daixia_history_zhi = models.CharField(max_length=4, choices=DHS_CHOICES, null=True, blank=True, verbose_name='带下质', help_text='带下质')

    yunchan_history = models.BooleanField(default=False, blank=True, verbose_name='孕产史', help_text='孕产史')

    yunchan_history_yun = models.IntegerField(null=True, blank=True, verbose_name='孕', help_text='孕')
    yunchan_history_shun = models.IntegerField(null=True, blank=True, verbose_name='顺产', help_text='顺产')
    yunchan_history_pou = models.IntegerField(null=True, blank=True, verbose_name='剖宫', help_text='剖宫')
    yunchan_history_zu = models.IntegerField(null=True, blank=True, verbose_name='足月产', help_text='足月产')
    yunchan_history_zao = models.IntegerField(null=True, blank=True, verbose_name='早产', help_text='早产')
    yunchan_history_zi = models.IntegerField(null=True, blank=True, verbose_name='自然流产', help_text='自然流产')
    yunchan_history_yi = models.IntegerField(null=True, blank=True, verbose_name='异位妊娠', help_text='异位妊娠')
    yunchan_history_di = models.IntegerField(null=True, blank=True, verbose_name='低体重儿', help_text='低体重儿')
    yunchan_history_ju = models.IntegerField(null=True, blank=True, verbose_name='巨大儿', help_text='巨大儿')
    yunchan_history_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='孕产史-其他', help_text='孕产史-其他')

    biyun = models.BooleanField(default=False, blank=True, verbose_name='避孕措施', help_text='避孕措施')

    biyun_jie = models.BooleanField(default=False, blank=True, verbose_name='输卵管结扎', help_text='输卵管结扎')
    biyun_qi = models.BooleanField(default=False, blank=True, verbose_name='宫内节育器', help_text='宫内节育器')
    biyun_tao = models.BooleanField(default=False, blank=True, verbose_name='避孕套', help_text='避孕套')
    biyun_kou = models.BooleanField(default=False, blank=True, verbose_name='口服避孕药', help_text='口服避孕药')
    biyun_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='避孕措施-其他', help_text='避孕措施-其他')

    family_history = models.BooleanField(default=False, blank=True, verbose_name='家族史', help_text='家族史')

    family_history_tang = models.BooleanField(default=False, blank=True, verbose_name='糖尿病', help_text='糖尿病')
    family_history_fei = models.BooleanField(default=False, blank=True, verbose_name='肥胖', help_text='肥胖')
    family_history_gao = models.BooleanField(default=False, blank=True, verbose_name='高血压', help_text='高血压')
    family_history_tiao = models.BooleanField(default=False, blank=True, verbose_name='母亲或姐妹月经不调', help_text='母亲或姐妹月经不调')
    family_history_tu = models.BooleanField(default=False, blank=True, verbose_name='父亲秃头', help_text='父亲秃头')
    family_history_liu = models.BooleanField(default=False, blank=True, verbose_name='妇科肿瘤', help_text='妇科肿瘤')
    family_history_qita = models.CharField(max_length=50, null=True, blank=True, verbose_name='家族史-其他', help_text='家族史-其他')

    guomin_history = models.BooleanField(default=False, blank=True, verbose_name='过敏史', help_text='过敏史')

    guomin_history_detail = models.CharField(max_length=50, null=True, blank=True, verbose_name='过敏史-具体描述', help_text='过敏史-具体描述')

    def __str__(self):
        return '%s-%s' % (self.pk, self.info)

    class Meta:
        verbose_name = '病史'
        verbose_name_plural = verbose_name
